package net.zjitc.bookshop15.mapper;

import net.zjitc.bookshop15.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 董熠涛
 * @date 2025/4/28 14:09
 */
@Mapper
public interface userMapper {

    @Select("SELECT * FROM sys_user WHERE username = #{username}")
    public User selectUserOne(String username);

    @Select("SELECT t1.perms FROM sys_menu t1\n" +
            "INNER JOIN role_menu t2 ON t1.`id` = t2.`menu_id`\n" +
            "INNER JOIN sys_user t3 ON t2.`role_id` = t3.`id`\n" +
            "INNER JOIN user_role t4 ON t3.`id` = t4.`role_id`\n" +
            "INNER JOIN sys_role t5 ON t4.`role_id` = t5.`id`\n" +
            "WHERE t3.`id` = #{id}")
    public List<String> selectUserPerms(Integer id);
}
